Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch UnicodeDecodeError in lobster-json #103

Merged
merged 2 commits into from
Oct 22, 2024
Merged

Catch UnicodeDecodeError in lobster-json #103

merged 2 commits into from
Oct 22, 2024

Conversation

phiwuu
Copy link
Member

@phiwuu phiwuu commented Oct 17, 2024

The UnicodeDecodeError is catched, and an error message is printed.
Afterwards lobster-json exits.

Issue: #102

@phiwuu phiwuu requested a review from a team as a code owner October 17, 2024 15:44
@phiwuu phiwuu self-assigned this Oct 17, 2024
@phiwuu phiwuu added the lobster-json Affects JSON integration label Oct 17, 2024
@phiwuu phiwuu requested a review from kedarnn October 17, 2024 15:45
@phiwuu phiwuu linked an issue Oct 17, 2024 that may be closed by this pull request
data = get_item(root = data,
path = options.test_list,
required = True)
except UnicodeDecodeError as decode_error:
print("%s: File is not encoded in utf-8: %s" % (file_name, decode_error))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I observed that the old string formatting method is used rather than f-strings, is there any specific reason due to which it is preferred?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there is no particular reason. I just used it because it is used everywhere else, to stay consistent.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something we should address in the coding guideline #88

The `UnicodeDecodeError` is catched,
and an error message is printed.
Afterwards `lobster-json` exits.

Issue: #102
@phiwuu phiwuu enabled auto-merge (squash) October 22, 2024 09:01
@phiwuu phiwuu merged commit 69635b8 into main Oct 22, 2024
21 checks passed
@phiwuu phiwuu deleted the decode_error branch October 22, 2024 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lobster-json Affects JSON integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Catch UnicodeDecodeError in lobster-json
3 participants